*Build code retrieved from ~/syzzle/code/wealth/do/xpez_20190202.do

capture program drop query_factors_Z/*%<*/
program define query_factors_Z

    * Query from Z server
    * Assessor file based on assessments made in 2012 or 2013
    local q = "SELECT sum(SA_TAX_VAL)/1000000 taxval," 
    local q = "`q'" + "sum(SA_VAL_ASSD)/1000000 totalval,"
    local q = "`q'" + "sum(SA_VAL_MARKET)/1000000 totalval2,"
    local q = "`q'" + "count(*) count, SA_SITE_STATE state "
    local q = "`q'" + "FROM assess GROUP BY SA_SITE_STATE"

    set odbcmgr unixodbc
    odbc load, exec("`q'") dsn("dataquick") clear
    outsheet using $analysis/dq_state_collapse_20190202.csv, replace

end/*%>*/
